import { DxButton, DxTextBox, DxSelectBox } from 'devextreme-vue'
export default {
  name: 'HelloWorld',
  components: {
    DxTextBox,
    DxButton,
    DxSelectBox
  },
  data: function() {
    return { age: '18' }
  },
  computed: {
    comProducts: function() {
      return [
        this.$t('lang.helloWorld.selectboxitemProduct1'),
        this.$t('lang.helloWorld.selectboxitemProduct2'),
        this.$t('lang.helloWorld.selectboxitemProduct3'),
        this.$t('lang.helloWorld.selectboxitemProduct4')
      ]
    }
  },
  methods: {
    toggleLang: function() {
      if (this.$i18n.locale === 'en') {
        this.$i18n.locale = 'zh'
      } else if (this.$i18n.locale === 'zh') {
        this.$i18n.locale = 'en'
      }
    },
    saveMeg: function() {
      alert(this.$t('lang.helloWorld.messageSave').replace('{0}', 1))
    },
    linkBtnClick: function() {
      const routeUrl = this.$router.resolve({
        path: '/second'
      })
      window.open(routeUrl.href, '_parent')
    }
  }
}
